home *** CD-ROM | disk | FTP | other *** search
- /*
- * "The Road goes ever on and on, down from the door where it began."
- */
-
- #ifdef macintosh
- #include <Types.h>
- #if __profile__
- #include <profiler.h>
- #endif
- #include "EXTERN.h"
- #include "icemalloc.h"
- #else
- #include "INTERN.h"
- #endif
- #include "perl.h"
-
- static void xs_init _((void));
- static PerlInterpreter *my_perl;
-
- /* This value may be raised by extensions for testing purposes */
- int perl_destruct_level = 0; /* 0=none, 1=full, 2=full with checks */
-
- int
- main(argc, argv, env)
- int argc;
- char **argv;
- char **env;
- {
- int exitstatus;
-
- #ifdef VMS
- getredirection(&argc,&argv);
- #endif
-
- #ifdef macintosh
- #if __profile__
- ProfilerInit(collectDetailed, bestTimeBase, 1000, 30);
- #endif
- mac_initminiperl();
- init_env(env);
- #endif
-
- #ifdef macintosh
- {
- #else
- if (!do_undump) {
- #endif
- #ifdef MALLOC_LOG
- MallocLog("Allocating...\n");
- #endif
- my_perl = perl_alloc();
- if (!my_perl)
- exit(1);
- #ifdef macintosh
- curinterp = my_perl;
- #endif
- #ifdef MALLOC_LOG
- MallocLog("Constructing...\n");
- #endif
- perl_construct( my_perl );
- }
-
- #ifdef MALLOC_LOG
- MallocLog("Parsing...\n");
- #endif
- exitstatus = perl_parse( my_perl, xs_init, argc, argv, env );
- if (!exitstatus) {
- #ifdef MALLOC_LOG
- MallocLog("Running...\n");
- #endif
- exitstatus = perl_run( my_perl );
- } else if (perl_destruct_level) {
- /* Shut up checks */
- perl_destruct_level = 1;
- }
-
- #ifdef MALLOC_LOG
- MallocLog("Destructing...\n");
- #endif
- perl_destruct( my_perl, perl_destruct_level );
- #ifdef MALLOC_LOG
- MallocLog("Freeing...\n");
- #endif
- perl_free( my_perl );
- #ifdef MALLOC_LOG
- MallocLog("That's all, folks...\n");
- #endif
-
- #ifdef macintosh
- #if __profile__
- ProfilerDump("\pMiniperl.Prof");
- ProfilerTerm();
- #endif
- #endif
-
- exit( exitstatus );
-
- #ifdef macintosh
- return 0;
- #endif
- }
-
- /* Register any extra external extensions */
-
- static void
- xs_init()
- {
- char *file = __FILE__;
- { extern void boot_MacPerl _((CV* cv));
- newXS("MacPerl::bootstrap", boot_MacPerl, file);
- }
- { extern void boot_DynaLoader _((CV* cv));
- newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file);
- }
- { extern void boot_NDBM_File _((CV* cv));
- newXS("NDBM_File::bootstrap", boot_NDBM_File, file);
- }
- { extern void boot_DB_File _((CV* cv));
- newXS("DB_File::bootstrap", boot_DB_File, file);
- }
- { extern void boot_Socket _((CV* cv));
- newXS("Socket::bootstrap", boot_Socket, file);
- }
- { extern void boot_Fcntl _((CV* cv));
- newXS("Fcntl::bootstrap", boot_Fcntl, file);
- }
- { extern void boot_POSIX _((CV* cv));
- newXS("POSIX::bootstrap", boot_POSIX, file);
- }
- { extern void boot_OSA _((CV* cv));
- newXS("OSA::bootstrap", boot_OSA, file);
- }
- { extern void boot_XL _((CV* cv));
- newXS("XL::bootstrap", boot_XL, file);
- }
- autoboot_preamble = "BEGIN { bootstrap MacPerl; bootstrap OSA; bootstrap XL; }";
- }
-